<template>
    <view class="box">
        <!-- 引入 nav-bar 组件，并传递页面标题 -->
        <nav-bar :navTitle="navTitle" />
        
        <!-- 支付成功主容器 -->
        <view class="success-container">
            <!-- 顶部状态提示 -->
            <view class="status-tip">
                <text class="status-text">支付成功</text>
            </view>
            
            <!-- 图标展示 -->
            <image src="../../../static/tabBar/zfcg.png" mode="aspectFit" class="success-icon" />
            
            <!-- 支付信息卡片 -->
            <view class="payment-info-card">
                <view class="info-title">支付信息</view>
                
                <view class="info-item">
                    <text class="info-label">订单类型：</text>
                    <text class="info-value">{{ orderType }}</text>
                </view>
                
                <!-- <view class="info-item">
                    <text class="info-label">订单时间：</text>
                    <text class="info-value">{{ orderTime }}</text>
                </view> -->

                <view class="info-item">
                    <text class="info-label">订单编号：</text>
                    <text class="info-value">{{ orderId }}</text>
                </view>
                
                <view class="info-item">
                    <text class="info-label">订单金额：</text>
                    <text class="info-value money">{{ orderAmount }}</text>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
const app = getApp();
const $http = app.globalData.$http;

export default {
    data() {
        return {
            navTitle: '支付结果',
            // 模拟支付信息数据
            orderType: '停车缴费',
            orderTime: '',
            orderAmount: '',
            orderId:''
        };
    },
    created() {
        // 页面加载后等待 3 秒跳转
        setTimeout(() => {
            uni.redirectTo({
                url: '/pages/parking/parking_pay/index'
            });
        }, 3000);
    },
    onLoad(options) {
        // 可以从参数中获取实际订单信息
          
        if (options.orderType){
            // this.orderType = options.orderType;
            options.orderType = decodeURIComponent(options.carNum || '');
        } 
        if (options.orderAmount) this.orderAmount = `¥${options.orderAmount}`;
        if (options.orderId) this.orderId = `¥${options.orderId}`;
        

    },
    methods: { }
};
</script>

<style>
.box {
    width: 750rpx;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f5f5f5;
    padding-top: 40rpx;
}

.success-container {
    width: 650rpx;
    background-color: #fff;
    border-radius: 20rpx;
    box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
    padding: 40rpx;
    margin-top: 40rpx;
}

.status-tip {
    display: flex;
    justify-content: center;
    margin-bottom: 20rpx;
}

.status-text {
    font-size: 24rpx;
    color: #999;
}

.success-icon {
    width: 160rpx;
    height: 160rpx;
    display: block;
    margin: 0 auto 40rpx auto;
}

.payment-info-card {
    border-top: 1rpx solid #f0f0f0;
    padding-top: 30rpx;
}

.info-title {
    font-size: 32rpx;
    font-weight: bold;
    color: #333;
    margin-bottom: 30rpx;
}

.info-item {
    display: flex;
    align-items: center;
    padding: 20rpx 0;
    border-bottom: 1rpx solid #f0f0f0;
}

.info-label {
    font-size: 28rpx;
    color: #666;
    width: 160rpx;
}

.info-value {
    font-size: 28rpx;
    color: #333;
    flex: 1;
    text-align: right;
}

.money {
    color: #e64340;
    font-weight: bold;
}
</style>